#include<iostream>
// zdl:: 这都啊题目局势使用哈希表加前缀和的思想
#include<unordered_map>
using ll = long long;
using namespace std;
unordered_map<ll, int> mp;

int main()
{
    int m;
    cin >> m;
    mp[0] = 0;
    int n = (m + 1) / 2;
    ll sum = 0;
    for (int i = 1; i <= n; i++)
    {
        sum += i;
        if (mp.count(sum - m)) 
        {
            cout << mp[sum - m] + 1 << " " << i << endl;
        }
        mp[sum] = i;
    }
    return 0;
}
